define(function(require, exports, module){
	require("resource/js/easyui/themes/icon.css");
	require("resource/js/easyui/easyloader.js");
	var AJAX = require("resource/js/component/ajax.js");
	var EUtil = require("resource/js/component/easyutil.js");
	var EC = require("resource/js/component/easycombobox.js");
	var dgutil = undefined;
	var config = {
		name:"沥青轨迹回放",
		column:[[
			{field:'id',title:'主键',width:100,align:'center',height:50,hidden:true},
		
			{field:'sectionId',title:'标段id',width:100,align:'center',height:50,hidden:true},
		
			{field:'transDate',title:'传输日期',width:100,align:'center',height:50,hidden:false,formatter:function(value,row,index){
				return row.transDate.length>10?row.transDate.substring(0,10):row.transDate;
	        }},
		
			{field:'startMileage',title:'起始里程',width:100,align:'center',height:50,hidden:false},
		
			{field:'endMileage',title:'结束里程',width:100,align:'center',height:50,hidden:false},
		
			{field:'layerId',title:'摊铺层级',width:100,align:'center',height:50,hidden:true},
			{field:'layerName',title:'摊铺层级',width:100,align:'center',height:50,hidden:false},
		
			{field:'pavingArea',title:'摊铺面积（㎡）',width:100,align:'center',height:50,hidden:false},
		
			{field:'totalDischarge',title:'出料总数（吨）',width:100,align:'center',height:50,hidden:true},
			
			{field:'xxxx',title:'操作',width:100,align:'center',height:50,formatter:function(value,row,index){
	        	return "<span><a class='viewBack tab_style' id='"+row.id+"' sectionId='"+row.sectionId+"' time ='"+row.transDate+"' index='"+index+"'>查看</a></span>";
	        }}
		]]
	}
	
	var initpage = function(){
		var sectionId = sessionStorage.getItem('sectionId');  //获取标段id
		$("#searchSectionId").val(sectionId);
		AJAX.init().success(function(code,msg,data){
			EC.init({ ele:"#layerId_search",valueField:'id',remote:true, textField:'layerName',
			}).load(data);
		}).error(function(code,msg,data){
		}).post(BASEPATH+'/dcs/sys/layer/querySysLayerList.htm');
		dgutil = EUtil.ajaxDataGrid(datagridconfig);
	}
	
	var viewQuality = function(target){
		$("#gridTime").val($(target).attr("time"));
		$("#viewdlg").dialog({
			iconCls: 'icon-save',
			//title:'查看回放',
			href:BASEPATH+'/view/dcs/asphalt/trail/trailVideo',
			onLoad:function(){
				//返回
				$("#zoom_back").on("click",function(){
					history.go(0);
					$("#viewdlg").dialog("close");
				});
			}
		});
		$("#viewdlg").dialog("open");
	}
	
	module.exports = {
		trans:function(){
			var buttons ={ 
				title:{
					_class:"",
					text:"沥青轨迹回放"
				},
				btn:[
					 {
						 iconCls: 'icon-search',
						 url:'/dcs/asphalt/trace/queryTraceAsphaltByPage.htm',
						 text:"查询",
//						 addClass:'l-btn-display',
						 btnType: 'searchBtn',
						 handler: function(){dgutil.pager(1);}
					 }
				]};
			datagridconfig = {
				fitColumns:true,
				singleSelect:false,
				striped:true,
				autoRowHeight:false,
				fit: true,
				toolbar:buttons,
				columns:config.column,
				eid:"dg",
				url:BASEPATH+'/dcs/asphalt/trace/queryTraceAsphaltByPage.htm',
				args:"searchform",
				onLoadSuccess:function(data){
					$(".viewBack").bind('click',function(){
						viewQuality(this);
					});
				}
			};
			
			using(["parser","dialog","datagrid","combobox" ],function(){
				initpage();
			});
		}
	}
});
